package com.nuoniu.sibanyun.service.production.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nuoniu.sibanyun.common.exception.NuoNiuException;
import com.nuoniu.sibanyun.common.lang.StringUtils;
import com.nuoniu.sibanyun.entity.production.VProcedurePriceDetail;
import com.nuoniu.sibanyun.entity.vo.ProcedureLastPriceVo;
import com.nuoniu.sibanyun.mapper.production.VProcedurePriceDetailMapper;
import com.nuoniu.sibanyun.service.production.IVProcedurePriceDetailService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 工序工价明细表 服务实现类
 * </p>
 *
 * @author 白强
 * @since 2021-08-14
 */
@Service
public class VProcedurePriceDetailServiceImpl extends ServiceImpl<VProcedurePriceDetailMapper, VProcedurePriceDetail> implements IVProcedurePriceDetailService {

    @Override
    public VProcedurePriceDetail getByProductionIdAndRouteDetailId(Integer productionId, Integer routeDetailId) {
        VProcedurePriceDetail vProcedurePriceDetail = baseMapper.getByProductionIdAndRouteDetailId(productionId, routeDetailId);
        return vProcedurePriceDetail;
    }

    @Override
    public List<ProcedureLastPriceVo> listProcedureLastPriceVo(Collection<?>  procedureIds) {
        if(null == procedureIds || procedureIds.size() == 0)throw new NuoNiuException("参数错误");
        String ids = StringUtils.join(procedureIds, ",");
        List<ProcedureLastPriceVo> procedureLastPriceVos = baseMapper.listProcedureLastPriceVo(ids);
        return procedureLastPriceVos;
    }

}
